home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / Coder.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  4.6 KB  |  159 lines

  1. /* Interface for GNU Objective-C coder object for use serializing
  2.    Copyright (C) 1994 Free Software Foundation, Inc.
  3.    
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: July 1994
  6.    
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.    
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.    */ 
  23.  
  24. #ifndef __Coder_h
  25. #define __Coder_h
  26.  
  27. #include <objects/stdobjects.h>
  28. #include <objects/Coding.h>
  29.  
  30. @class Stream;
  31. @class Dictionary;
  32. @class Stack;
  33.  
  34. @interface Coder : Object
  35. {
  36.   int format_version;
  37.   int concrete_format_version;
  38.   Stream *stream;
  39.   BOOL is_decoding;
  40.   BOOL doing_root_object;
  41.   Dictionary *object_table;         /* read/written objects */
  42.   Dictionary *const_ptr_table;       /* read/written const *'s */
  43.   Stack *root_object_tables;         /* Stack of Dicts for interconnt'd objs */
  44.   Stack *forward_object_tables;      /* Stack of Dictionaries for frwd refs */
  45. }
  46.  
  47. + (void) setDefaultStreamClass: sc;
  48. + defaultStreamClass;
  49. + setDebugging: (BOOL)f;
  50.  
  51. - initEncodingOnStream: (Stream *)s;
  52. - initDecodingOnStream: (Stream *)s;
  53. - initEncoding;
  54. - initDecoding;
  55. - init;
  56.  
  57. - free;
  58. - (BOOL) isDecoding;
  59.  
  60. - (void) encodeValueOfType: (const char*)type 
  61.    at: (const void*)d 
  62.    withName: (const char *)name;
  63. - (void) decodeValueOfType: (const char*)type
  64.    at: (void*)d 
  65.    withName: (const char **)namePtr;
  66.  
  67. - (void) encodeWithName: (const char *)name
  68.    valuesOfTypes: (const char *)types, ...;
  69. - (void) decodeWithName: (const char **)name
  70.    valuesOfTypes: (const char *)types, ...;
  71.  
  72. - (void) encodeArrayOfType: (const char *)type
  73.    at: (const void *)d
  74.    count: (unsigned)c
  75.    withName: (const char *)name;
  76. - (void) decodeArrayOfType: (const char *)type
  77.    at: (void *)d
  78.    count: (unsigned *)c
  79.    withName: (const char **)name;
  80.  
  81. - (void) encodeObject: anObj
  82.    withName: (const char *)name;
  83. - (void) encodeObjectBycopy: anObj
  84.    withName: (const char *)name;
  85. - (void) decodeObjectAt: (id*)anObjPtr
  86.    withName: (const char **)name;
  87.  
  88. - (void) encodeRootObject: anObj
  89.    withName: (const char *)name;
  90. - (void) encodeObjectReference: anObj
  91.    withName: (const char *)name;
  92. - (void) startEncodingInterconnectedObjects;
  93. - (void) finishEncodingInterconnectedObjects;
  94. - (void) startDecodingInterconnectedObjects;
  95. - (void) finishDecodingInterconnectedObjects;
  96.  
  97. - (void) encodeAtomicString: (const char*)sp
  98.    withName: (const char*)name;
  99. - (const char *) decodeAtomicStringWithName: (const char **)name;
  100.  
  101. - decodeClass;
  102. - (void) encodeClass: aClass;
  103.  
  104. /* For inserting a name into a TextCoder stream */
  105. - (void) encodeName: (const char*)n;
  106. - (void) decodeName: (const char**)n;
  107.  
  108. /* For subclasses that want to keep track of recursion */
  109. - (void) encodeIndent;
  110. - (void) encodeUnindent;
  111. - (void) decodeIndent;
  112. - (void) decodeUnindent;
  113.  
  114. /* Implemented by concrete subclasses */
  115. - (void) encodeValueOfSimpleType: (const char*)type 
  116.    at: (const void*)d 
  117.    withName: (const char *)name;
  118. - (void) decodeValueOfSimpleType: (const char*)type 
  119.    at: (void*)d 
  120.    withName: (const char **)namePtr;
  121. - (void) encodeBytes: (const char *)b
  122.    count: (unsigned)c
  123.    withName: (const char *)name;
  124. - (void) decodeBytes: (char *)b
  125.    count: (unsigned*)c
  126.    withName: (const char **)name;
  127.  
  128. - (int) coderFormatVersion;
  129. - (int) coderConcreteFormatVersion;
  130.  
  131. - (void) resetCoder;        /* xxx remove this? */
  132.  
  133. - doInitOnStream: (Stream *)s isDecoding: (BOOL)f;
  134. /* Internal designated initializer.  Override it, but don't call it yourself.
  135.    This method name may change. */
  136.  
  137. + (int) coderFormatVersion;
  138. + (int) coderConcreteFormatVersion;
  139. + (const char *) coderSignature;
  140.  
  141. @end
  142.  
  143. @interface Object (CoderAdditions) <Coding>
  144. - (void) encodeWithCoder: (Coder*)anEncoder;
  145. + newWithCoder: (Coder*)aDecoder;
  146.  
  147. /* These methods here temporarily until ObjC runtime category bug fixed */
  148. - classForConnectedCoder:aRmc;
  149. + (void) encodeObject: anObject withConnectedCoder: aRmc;
  150. - (id) retain;
  151. - (void) release;
  152. - (void) dealloc;
  153. - (unsigned) retainCount;
  154. - (BOOL) isProxy;
  155.  
  156. @end
  157.  
  158. #endif __Coder_h
  159.